<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "purchase");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
	
<style>

 #lineTd {
        background: #fff url() no-repeat 100% center;
   
}
 #area{
		height: 488px;
		overflow-y:auto; 
		overflow-x:hidden; 
	}
</style>
<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
    <div class="detailed-navbar-content panel-body">
    	
        <t:form modelAttribute="purchase" action="/purchase/purchase/save" method="post" cssClass="form-horizontal">
            <div class="hide">
                <t:hidden path="purchaseId"/>
                <t:hidden path="deleteMark"/>
                
            </div>
        
          
            <div class="panel-header" style="height:50px;margin:0 auto  ">
            		<label style="color:red;font-size:1.6em;margin-left:20px;margin-top:5px"><t:provider packageName="purchase" enumClassName="PurchaseState" value="${purchase.purchaseState }"/></label><label  style="font-size:1.2em;margin-left:20px">采购单号 : ${purchase.purchaseNo }</label><label style="font-size:1.2em;margin-left:20px">供应商 :  ${purchase.supplier.supplierName }	</label><label style="font-size:1.2em;margin-left:20px">采购员 : ${purchase.purchaseName }	</label><label style="font-size:1.2em;margin-left:20px">采购日期 : <fmt:formatDate value="${purchase.createDate}" type="date" dateStyle="default" pattern="YY-MM-dd HH:mm"/>	</label>				
			</div>
			<div id="area">
				<table class="cntable table table-bordered  " >
					<thead>
						<tr  >
							<th style="width:50px">序号</th>
							<th >
							 	
							</th>
							<!-- <th style="width:120px">商品编码</th> -->
							<th style="width:120px">商品名称</th>
							<th style="width:120px">规格</th>
							<th style="width:60px">单位</th>
							<th style="width:60px">采购数</th>
							<th style="width:60px">采购单价(元)</th>
							<th style="width:60px">小计(元)</th>
							<th>备注</th>
						</tr>
					</thead>
					<tbody>
					
					<c:forEach var="purchaseCollocation" items="${purchase.purchaseCollocations}" varStatus="status">
						<tr class="success" data-id="${purchaseCollocation.id }">
							<td>${status.index+1 }</td>
							<td  id="lineTd" style="background-color:#E8F6E8">
								<span style="float:left;margin-top:20px;">项目</span>
            					<span style="float:right;margin-top:-10px;">商品</span>
							</td>
						<%-- 	<td>${purchaseCollocation.collocation.collocationNo }</td> --%>
							<td>${purchaseCollocation.cargo.cargoName }</td>
							<td>${purchaseCollocation.collocation.propertyNameOne }/${purchaseCollocation.collocation.propertyNameTwo }</td>
							<td>${purchaseCollocation.cargo.unit }</td>
							<td class="name_no">${purchaseCollocation.purchaseNumber }</td>
							<td class="name_no">${purchaseCollocation.purchasePrice }</td>
							<td class="name_no">${purchaseCollocation.purchaseNumber*purchaseCollocation.purchasePrice }</td>
							<td>${purchaseCollocation.comment }</td>
						</tr>
						<c:forEach var="purpose" items="${purchaseCollocation.purposes}" varStatus="status">	
						<tr  data-id="${purpose.purposeId }">
							<td ></td>
							
							<td colspan="3">${purpose.project.projectName }</td>
							<td >${purchaseCollocation.cargo.unit }</td>
							<td>${purpose.purposeNum }</td>
							<td>${purchaseCollocation.purchasePrice }</td>
							<td>${purchaseCollocation.purchasePrice*purpose.purposeNum }</td>
							<td>${purpose.comment }</td>
						</tr>
						</c:forEach>		
					</c:forEach>
					
										
					</tbody>
					
				</table>     
				
			
			</div>
			
        </t:form>
    </div>

</t:panel>



<script type="text/javascript">

function saveData(lBtn){
	if (!$("form:first").valid()){
		return;
	}
	lBtn.start();
	$("form:first").submit();
}	


$(function(){
	resizeEx();
	$(window).resizeend({delay : 500}, function() {
		resizeEx();
	});
});

function resizeEx(){
	$(".panel-body").height($(window).height()-22)
}


</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/cntable.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formtags.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>
